package reduce.fz.com.reduce.activity;

import android.os.Bundle;
import android.support.v7.widget.RecyclerView;

import java.util.List;

import reduce.fz.com.reduce.R;
import reduce.fz.com.reduce.adapter.FindAdapter;
import reduce.fz.com.reduce.bean.FindBanner;
import reduce.fz.com.reduce.bean.TeamCategory;
import reduce.fz.com.reduce.bean.page.Pagination;

public class FindActivity extends BaseToolBarActivity {
    /*发现列表*/
    private RecyclerView mFindListView;
    /*分页对象*/
    private Pagination pagination;
    /*发现适配器*/
    private FindAdapter mFindAdapter;
    /*banner广告位*/
    private List<FindBanner> banners;
    /*发现列表对象*/
    private List<TeamCategory> findfolders;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_find);
        mToolbar.inflateMenu(R.menu.menu_find);
    }


  /*  public void loadmore() {
        String url = getRequestUrl();
        http(url, pagination.nextPage());
    }

    public String getRequestUrl() {
        return "";
    }

    public void http(String url, Pagination page) {
        HttpUtils.get(url, new Response.Listener<String>() {
            public void onResponse(String jsonStr) {
                Result<FindResult> result = JsonUtil.convert(jsonStr, new TypeReference<Result<FindResult>>() {
                });
                mFindAdapter.addBannerList(result.getObject().getBanners());
                mFindAdapter.addFolderList(result.getObject().getFolders());
            }
        }, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                volleyError.printStackTrace();

            }
        });
    }


    public void init() {
        mFindAdapter = new FindAdapter(this.getBaseContext(), null, null, new FindAdapter.FindListener() {
            @Override
            public void onClickBanner(FindBanner banner) {
                Intent intent = new Intent(getBaseContext(), FindCardDetailActivity.class);
                intent.putExtra("folderId", banner.getId());
                startActivity(intent);

            }

            @Override
            public void onClickFolder(FindTopic folder) {
                Intent intent = new Intent(getBaseContext(), FindCardDetailActivity.class);
                intent.putExtra("folderId", folder.getFolderId());
                startActivity(intent);

            }
        });
        mFindListView = (RecyclerView) this.findViewById(R.id.find_listview);
        RecycleOper recycleOper = new RecycleOper(this, mFindListView);
        recycleOper.setDefault();
        mFindListView.setAdapter(mFindAdapter);
        recycleOper.setRecycleScrollListener(new RecycleOper.RecycleTrigger() {
            @Override
            public void deal() {
                loadmore();
            }
        });
    }
*/
    @Override
    public void initWidget() {
        mFindListView = (RecyclerView) this.findViewById(R.id.find_listview);
    }

    @Override
    public void initListener() {

    }
}
